home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 November / Chip_2004-11_cd1.bin / zkuste / dolby / download / dvdlab / DVDlabProRC2b.exe / {app} / Extras / Script / Flip Vertical.talk < prev    next >
Text File  |  2004-03-22  |  2KB  |  54 lines

  1. /*    Vertical Flip 1.0
  2.     by Oscar, 12 Dec 2003
  3.     
  4.     this example simply flips a bitmap or object
  5.     
  6.     To run this: DROP the Script from Assets to the Object in Menu.
  7.  
  8.     
  9.     Note: because of the bitmap merging, the text will become not-editable after you apply this
  10. */
  11.  
  12. // Get the current menu and selected object when you drag and drop script
  13. // Note: if testing from Script editor make sure you have just one menu opened on desktop,
  14. //       in such case the MenuGetCurSel will return currently opened menu 
  15. menu = MenuGetCurSel() 
  16. // VTS menu 1..255, VMG menu 10001..10255 
  17.  
  18. // show the current menu on top of all others
  19. MenuActivate(menu)
  20.  
  21. object= ObjectGetCurSel(menu) 
  22.  
  23. if (object==0) then
  24.     print "No object Selected"
  25.     end
  26. endif
  27.     
  28.     
  29. //get the image buffer from object and store it in buffer 1
  30. ImgGrabObject(1,menu,object) // imgNum = temporary image buffer 1,2 or 3
  31.  
  32. imgW = ImgGetWidth(1) 
  33. imgH = ImgGetHeight(1)
  34.  
  35. // create the target, same size
  36. ImgCreate(2,imgW,imgH)
  37.  
  38. // trace is same as print, but it will appear only in the Output window in editor
  39. trace "Vertical Flipping W =",imgW, " H=",imgH
  40.  
  41. // this is interpreter so it is slow!
  42. // show some progress or else people will see nothing happening for while
  43. ProgressBar(0,imgH,"Flipping!")
  44.  
  45. // all in lab-talk starts from 1, also the image, the first line is line 1
  46. for y=1 to imgH
  47.     ProgressSetPos(y)
  48.     // copy row from 1 to 2
  49.     ImgCopyRow(1,y,2,imgH-y+1)
  50. next x
  51.  
  52. // now put the img buffer 2 into the object!
  53. ImgSetToObject(2,menu,object)